package com.example.demo2.beancfg;

import com.example.demo2.bean.CdPlayer;
import com.example.demo2.bean.Library;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//使用 @Configuration 类专门配置
//创建一个专门的配置类来定义 CdPlayer 和 Library bean
@Configuration
public class CDConfig {
    @Bean
    public Library library() {
        return Library.buildSampleLibrary();
    }

    @Bean
    public CdPlayer cdPlayer() {
        return new CdPlayer();
    }
}
